<!doctype html>
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<title>客户推荐</title>
<link href="../../css/newStyle.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../../js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script type="text/javascript" src="../../js/gbRst.js"></script>
<script type="text/javascript" src="../../js/utils.js"></script>
<script type="text/javascript" src="../../js/openId.js"></script>
<script type="text/javascript" src="../../js/header&footer.js"></script>
<!-- <script type="text/javascript" src="../../js/carService.js"></script>
 --><script type="text/javascript" src="../../js/doubleDate2.0.js"></script>
<script type="text/javascript" src="../../js/check.js"></script>
<script type="text/javascript" src="../../js/qmsk-1.2.js"></script>
<script type="text/javascript">
var memberId = 0;
var memberName = null;
$(function(){
	var  member=_findInfo("../../../member/find/shopId/"+getShopId()+"/openId/"+getOpenId(), null)
	if(IsNotEmpty(member)&&member.state==0){
		memberName = getHtmlString(getHeadIndexValue(0, member, "CustomerName"))
		memberId=getHtmlString(getHeadIndexValue(0, member, "memberId"));
		if(IsEmpty(memberId)){
			alert("您还不是会员，不能推荐客户，请注册会员后再次推荐")
			return false;
		}
	}
	
	
})

function save(){
	var custName= $("#custName").val();
	var mp = $("#mp").val();
	var type = $("#type").val()
	var memo = $("#memo").val()
	if(!checkNull(custName, "姓名", "custName")||!checkNull(mp,"电话","mp")){
		return false;
	}
	
	if(IsEmpty(memberId)){
		alert("您还不是会员，不能推荐客户，请注册会员后再次推荐")
		return false;
	}
	var heads = new Array("recommendId","recommendName","recommendedName","mp","type","memo","shopId");
	var datas = new Array(memberId,memberName,custName,mp,type,memo,_shopId)
	var params = _getJsonParseInsertStr(heads, datas);
	var dt = _insertInfoShow("../../../recommendMan/insert/insertInfo", {"data":params,'openId':_openId})
	if(IsNotEmpty(dt)&&dt.state==0){
		resetForm()
	}
}
function resetForm(){
	$("#custName").val("");
	$("#mp").val("");
	$("#memo").val("");
}
</script>
</head>

<body>
<div class="wrapper">
  <div class="container">
    <h2 class="xilie"><span>客户推荐</span></h2>
        <div class="person">
            推荐客户姓名<span class="red">*</span><br>
            <input name="custName" id="custName" type="text" class="txt">
        </div>
        <div class="person">
            推荐客户电话<span class="red">*</span><br>
            <input name="mp" id="mp" type="text" class="txt">
        </div>
        <div class="person">
            推荐类型<span class="red">*</span>
            <select id="type">
                <option value='2'>试驾</option>
            	<option value='1'>维修</option>
                <option value='3'>保养</option>
                <option value='4'>保险</option>
            </select>
        </div>        
        <div class="person">
            备注	<br>
            <textarea id= memo ></textarea>
        </div>
        <div class="give">
            <input type="button" value="立即推荐" class="giveBtn" onclick="save()">
        </div>
  </div>
</div>
</body>
</html>
